package com.jiantong.web;

import com.jiantong.web.core.cloud.service.impl.AliyunFileServer;
import com.jiantong.web.open.OpenSecurityManager;
import io.terminus.pampas.openplatform.core.SecurityManager;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Author:cp
 * Created on 9/7/16.
 */
@Configuration
public class OpenApiConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public SecurityManager openSecurityManager(){
        return new OpenSecurityManager();
    }

    @Bean
    public AliyunFileServer aliyunFileServer(@Value("${oss.endpoint}") String endpoint,
                                             @Value("${oss.secretId}") String secretId,
                                             @Value("${oss.secretKey}") String secretKey,
                                             @Value("${oss.bucketName}") String bucketName) {
        return new AliyunFileServer(endpoint, secretId, secretKey, bucketName);
    }

}
